package com.lightning.modules.validator;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lightning.modules.validator.data.Command;
import com.lightning.modules.validator.validators.AbstractValidator;

@Service
public class ValidatorContext {
	@SuppressWarnings("unused")
	private ValidatorResolver resolver;
	private List<Command> cmds;
	@Autowired
	public ValidatorContext(ValidatorResolver resolver) {
		this.resolver = resolver;
		initializeContext(resolver);
	}

	public void initializeContext(ValidatorResolver resolver) {
		List<AbstractValidator> list = resolver.resolveValidator();
		for (AbstractValidator validator : list) {
			ValidatorRegistry.instance.registerValidator(validator);
		}
		cmds = resolver.resolverCommand();
	}

	public List<Command> getCmds() {
		return cmds;
	}
}
